import { Decrypt } from '@/utils/aes.js'
import request from './request.js'

//用户名密码登录
export function loginByJson(params){
    return request({
        url:'/api/u/loginByJson',
        method:'POST',
        data:params
    })
}

//创建Token
export function createToken(){
    return request({
        url:'/api/token/createToken',
        method:'POST'
    })
}

//获取个人信息
export function getInfo({token}){
    return request({
        url:'/api/member/getInfo?token=' + token,
        method:'GET',
        headers:{
            'Authorization':Decrypt(localStorage.getItem('token'))
        }
    })
}

//手机验证码登录
export function loginByMobile(params){
    return request({
        url:'/api/u/loginByMobile',
        method:'POST',
        data:params
    })
}